-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I want a way to get a function while knowing it hasn't been interfered with by the user. To solve this problem, one could preemptively run glua.ref_get(lua, ["getmetatable"]) before user scripts, but this being the only way causes some problems. Creating a helper function that checks for a certain metatable field would require the helper function to accept a getmetatable: ValueRef. (Since running glua.ref_get(lua, ["getmetatable"]) in the function could yield a possibly tampered with function.)
To solve this problem, I propose that glua should expose the stdlib functions through a module that could be called lib (or something else). lib would have functions that could get standard library lua functions.
Example usage:
fn check_magic(lua: Lua, table: ValueRef) -> Bool {
let getmetatable = lib.getmetatable() // We can discuss if this should be a function or not
case glua.call_function(lua, getmetatable, [table]) {
Ok(#(lua, [metatable])) ->{
// do stuff with metatable
True
}
_ -> False
}
}
}Metadata
Metadata
Assignees
Labels
No labels