satoren / kaguya

C++ binding to Lua
Boost Software License 1.0
345 stars 70 forks source link

kaguya call lua #99

Open liwei1024 opened 3 years ago

liwei1024 commented 3 years ago

For example, I have a piece of code in Lua that calls " game_data.task:test() "

How is the Kaguya called

I tried the “state [" game_data "] [" task "] [" test "] ()” and the “state [" game_data. Task: test "] ()”

satoren commented 3 years ago

Can you try below.

auto result = state["game_data"]["task"]["test"](state["game_data"]["task"])

or

auto result = state.loadstring("return game_data.task:test()")()

If you do not need return data

state("game_data.task:test()")