natiny.script.make_bytes

Lua
natiny.script.make_bytes(data [, size]) -> string

Takes the first size bytes of a string. The Lua twin of natiny_script_make_bytes(), which in C is how a byte range becomes a value.

Parameters

Name Type Default Description
data string The bytes; embedded zeroes are allowed
size number #data How many to take, counted from the front; more than there are takes all of them

Returns

Type Description
string The first size bytes of data

Example

Lua
local label = "A\0B and more"

natiny.script.set(mod, "game.label", natiny.script.make_bytes(label, 3))