Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.62 KB | None | 0 0
  1. 'function i register
  2. Public Function Print(ByVal lua_state As IntPtr) As Integer
  3.     Console.WriteLine(clua.GetString(-1))
  4. End Function
  5.  
  6. 'how i register a function
  7.  
  8. clua.RegisterCfunction("print", AddressOf Print)
  9.  
  10.     Public Sub RegisterCfunction(ByVal refname As String, ByVal func As LuaCFunction)
  11.         register(cLuaState, refname, func)
  12.     End Sub
  13.  
  14. Friend Sub register(ByVal lua_state As IntPtr, ByVal name As String, ByVal func As LuaCFunction)
  15.     Dim top As Integer = lua_gettop(lua_state) 'upvalues
  16.     lua_pushcclosure(lua_state, func, top)
  17.     lua_setfield(lua_state, LUA_GLOBALSINDEX, name)
  18. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement