DHTML:AddFunction
Example
Prints text from Javascript to the console in color.
Example
Passing a callback to the added JavaScript function as the last argument allows us to use the values returned by our Lua function.
Of course, you're allowed to use multiple return values, with each being its own argument.
Tables should work as you expect them to. Lua table {true, a = true}
will be an object with keys 1
and a
, both equal to true
.
Unsure about metatable behavior.
Userdata (Vector
, Player
, etc...) will be undefined
, obviously.
As per https://github.com/Facepunch/garrysmod-issues/issues/3995#issuecomment-531491316
This is relevant for the x86-64 branch only (Chromium in place of Awesomium), you may still handle return values normally to work with the default branch as well.