Пример #1
0
Файл: opcode.c Проект: cskau/VM
/*
** Get a global object.
*/
lua_Object lua_getglobal (char *name)
{
 adjustC(0);
 getglobal(luaI_findsymbolbyname(name));
 CLS_current.base++;  /* incorporate object in the stack */
 return Ref(top-1);
}
Пример #2
0
/*
** Internal function: return next global variable
*/
static void lua_nextvar (void)
{
 Word next;
 lua_Object o = lua_getparam(1);
 if (o == LUA_NOOBJECT)
   lua_error("too few arguments to function `nextvar'");
 if (lua_getparam(2) != LUA_NOOBJECT)
   lua_error("too many arguments to function `nextvar'");
 if (lua_isnil(o))
   next = 0;
 else if (!lua_isstring(o))
 {
   lua_error("incorrect argument to function `nextvar'"); 
   return;  /* to avoid warnings */
 }
 else
   next = luaI_findsymbolbyname(lua_getstring(o)) + 1;
 while (next < lua_ntable && s_tag(next) == LUA_T_NIL) next++;
 if (next >= lua_ntable)
 {
  lua_pushnil();
  lua_pushnil();
 }
 else
 {
  lua_pushstring(lua_table[next].varname->str);
  luaI_pushobject(&s_object(next));
 }
}
Пример #3
0
Файл: opcode.c Проект: cskau/VM
int lua_call (char *funcname)
{
 Word n = luaI_findsymbolbyname(funcname);
 open_stack((top-stack)-CLS_current.base);
 stack[CLS_current.base] = s_object(n);
 return do_protectedrun(MULT_RET);
}
Пример #4
0
void luaI_initsymbol (void)
{
  int i;
  lua_maxsymbol = BUFFER_BLOCK;
  lua_table = newvector(lua_maxsymbol, Symbol);
  for (i=0; i<INTFUNCSIZE; i++)
  {
    Word n = luaI_findsymbolbyname(int_funcs[i].name);
    s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = int_funcs[i].func;
  }
}
Пример #5
0
Файл: opcode.c Проект: cskau/VM
/*
** Store top of the stack at a global variable array field.
*/
void lua_storeglobal (char *name)
{
 Word n = luaI_findsymbolbyname(name);
 adjustC(1);
 s_object(n) = *(--top);
}
Пример #6
0
void lua_rawsetglobal (char *name)
{
  Word n = luaI_findsymbolbyname(name);
  checkCparams(1);
  s_object(n) = *(--top);
}
Пример #7
0
void lua_setglobal (char *name)
{
  checkCparams(1);
  setglobal(luaI_findsymbolbyname(name));
}
Пример #8
0
lua_Object lua_rawgetglobal (char *name)
{
  return put_luaObject(&lua_table[luaI_findsymbolbyname(name)].object);
}
Пример #9
0
/*
** Get a global object.
*/
lua_Object lua_getglobal (char *name)
{
  getglobal(luaI_findsymbolbyname(name));
  return put_luaObjectonTop();
}