lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I am trying to write a Lua wrapper for my hobby game engine in C++.
Here is the thing.

How could I bind a table to lightuserdata?
I wanna expose a Lua API like this.

local sprite = require "engine.sprite" -- C module
local s = -- returns a C lightuserdata

s.custom_user_defiend_filed = "some value" -- the user may use the lightuserdata like a simple table

After dig a while, I found tolua++ have the setpeer/getpeer which what all I want,
but since Lua 5.3 have removed the setfenv, how could I achieve the same goal?

Thanks in advance. :)