Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua state gets confused with table callbacks #608

Closed
madmaxoft opened this issue Jan 31, 2014 · 1 comment
Closed

Lua state gets confused with table callbacks #608

madmaxoft opened this issue Jan 31, 2014 · 1 comment
Assignees

Comments

@madmaxoft
Copy link
Member

When using table of callback functions, the lua state gets confused and won't execute other functions properly.

Consider the following piece of code:

local World = Player:GetWorld()
local Callbacks =
{
    OnNextBlock = function(X, Y, Z, BlockType, BlockMeta)
        if (BlockType ~= E_BLOCK_AIR) then
            LOG("World.DoExplosionAt = " .. tostring(World.DoExplosionAt))
            World:DoExplosiontAt(2, X, Y, Z, false, esPlugin, nil)
            return true
        end
        World:SetBlock(X, Y, Z, E_BLOCK_DIAMOND_BLOCK, 0)
        World:QueueSetBlock(X, Y, Z, E_BLOCK_AIR, 0, 30)
    end
}
cLineBlockTracer.Trace(World, Callbacks, Start.x, Start.y, Start.z, End.x, End.y, End.z)

It outputs "World.DoExplosionAt = function (0xblablabla)", but yet fails to call the function, saying "attempt to call method 'DoExplosionAt' (a nil value)"

@ghost ghost assigned madmaxoft Jan 31, 2014
@madmaxoft
Copy link
Member Author

The bug is in the lua code, there's a typo in the DoExplosionAt() call, an extra T.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant