Welcome!

You are just one step away from creating awesome games!

Sign up with Google

You need a Google account to use Defold

- Select ref document -

HTML5 API documentation

version 1.2.111

HTML5 platform specific functions.

The following functions are only available on HTML5 builds, the html5.* Lua namespace will not be available on other platforms.

Functions

html5.run

html5.run(code)

Executes the supplied string as JavaScript inside the browser. A call to this function is blocking, the result is returned as-is, as a string. (Internally this will execute the string using the eval() JavaScript function.)

Parameters

code

string Javascript code to run

code

string Javascript code to run

Returns

result

string result as string

result

string result as string

Examples

local res = html5.run("10 + 20") -- returns the string "30"
print(res)
local res_num = tonumber(res) -- convert to number
print(res_num - 20) -- prints 10

I want to report anonymously.