LuaInterface.LuaDLL.lua_isfunction C# (CSharp) Method

lua_isfunction() public static method

public static lua_isfunction ( IntPtr luaState, int stackPos ) : bool
luaState System.IntPtr
stackPos int
return bool
        public static bool lua_isfunction(IntPtr luaState, int stackPos)
        {
            return lua_type(luaState, stackPos) == LuaTypes.LUA_TFUNCTION;
        }

Usage Example

示例#1
0
 public string GetFunctionInfo()
 {
     LuaDLL.lua_getglobal(L, "FormatFunctionInfo");  //-> f, FormatFunctionInfo
     if (LuaDLL.lua_isfunction(L, -1))
     {
         LuaDLL.lua_pushvalue(L, -2); //-> f, FormatFunctionInfo, f
         if (PCall(1, 1))             //-> f, callbackInfo
         {
             string callbackInfo = LuaDLL.lua_tostring(L, -1);
             LuaDLL.lua_pop(L, 2);
             return(callbackInfo);
         }
         else    //-> f, err
         {
             string errInfo = LuaDLL.lua_tostring(L, -1);
             LuaDLL.lua_pop(L, 2);
             return(errInfo);
         }
     }
     else    //-> f, xx
     {
         LuaDLL.lua_pop(L, 2);
         return("failed to call FormatFunctionInfo");
     }
 }
All Usage Examples Of LuaInterface.LuaDLL::lua_isfunction
LuaDLL