Ulua_toLua_基本案例(四)_AccessingLuaVariables
2016-02-27 15:26
423 查看
using UnityEngine; using System.Collections; using LuaInterface; public class AccessingLuaVariables : MonoBehaviour { private string script = @" print('Objs2Spawn is: '..Objs2Spawn) var2read = 42 Layers = {} Layers.default = 1 function TestFunc(strs) print('get func by variable') end "; void Start () { LuaState lua = new LuaState(); lua["Objs2Spawn"] = 5; lua.DoString(script); Debugger.Log("Read var from lua: {0}", lua["var2read"]); Debugger.Log("Read table var from lua: {0}", lua["Layers.default"]); LuaFunction func = lua["TestFunc"] as LuaFunction; func.Call(); func.Dispose(); lua.CheckTop(); lua.Dispose(); } }
相关文章推荐
- Ulua_toLua_基本案例(三)_CallLuaFunction
- Ulua_toLua_基本案例(二)_ScriptsFromFile
- Ulua_toLua_基本案例(一)
- Lua的C++封装
- lua与c++结合
- ngx_lua_waf利用HPP完全绕过防御机制
- LuaStudio编辑调试软件
- 如何在Windows平台使用VS搭建C++/Lua的开发环境
- Lua安装及遇到的问题
- Lua的table函数库
- C++返回table给lua
- 在OpenResty中使用lua-zlib的方法
- Lua的math函数库及一些自定义扩展
- 将Lua解释器移植到STM32
- protobuf-gen-lua 不能支持int64 的解决方法 !!
- lua获取当时时间
- Lua_热更新
- lua 取一个数字的整数部分
- Lua 5.2 视频教程
- Evaluation