AdUki / LuaState

Lua51-52 binding library
Apache License 2.0
77 stars 14 forks source link

run time error #7

Closed crosslife closed 10 years ago

crosslife commented 10 years ago

LuaState.h line 84, always throw error.

cpp: lua::State state; state.doFile("scripts/test1.lua");

test1.lua:

function lua_func(arg1, arg2) return arg1 + arg2 end

result = cpp_func(1, 2)

function checkLuaResult() return result == 3 end

AdUki commented 10 years ago

cpp_func in test1.lua is nil, line state.doFile("scripts/test1.lua"); will throw lua::RuntimeError because of line result = cpp_func(1, 2) in test1.lua file

you should write result = lua_func(1, 2) instead