Create a global table for LUA stack

来源:互联网 发布:西安软件公司软件开发 编辑:程序博客网 时间:2024/05/17 12:56

         lua_newtable(L);
        while (thia)
        {
            /*set key*/
            if (thia->keytype == LUA_TSTRING)
            {
                lua_pushstring(L,thia->key.skey);
            }
            else
            {
                lua_pushnumber(L,thia->key.ikey);
            }
            /*set value*/
            if(thia->valuetype == LUA_TSTRING)
            {
                lua_pushstring(L,thia->value.svalue);
            }
            else if (thia->valuetype ==LUA_TBOOLEAN)
            {
                lua_pushboolean(L,thia->value.ivalue);
            }
            else if (thia->valuetype ==LUA_TNUMBER)
            {
                lua_pushnumber(L,thia->value.dvalue);
            }
            lua_settable(L,-3);
            thia = thia->next;
        }
        lua_setglobal(L,ARGUMENTS);

原创粉丝点击