@skyrim-platform/jcontainers
Version:
TypeScript library for the JContainers Skyrim modding utility
30 lines (26 loc) • 2.31 kB
TypeScript
import { Form } from "skyrimPlatform";
/** Evaluates piece of Lua code. The arguments are carried by @transport object.
The @transport is any kind of object, not just JMap.
If @minimizeLifetime is True the function will invoke JValue.zeroLifetime on the @transport object.
It is more than wise to re-use @transport when evaluating lot of lua code at once.
Returns @default value if evaluation fails.
WARNING: You can transfer in/out from Lua only 24-bit integers with exact precision (+/- 16 777 216)
Anything bigger or smaller than that will have "holes" due to how the floating point rounding works.
Usage example:
; 7 from the end until 9 from the end. Returns "Lua" string
string input = "Hello Lua user"
string s = JLua.evaLuaStr("return string.sub(args.string, args.low, args.high)",\
JLua.setStr("string",input, JLua.setInt("low",7, JLua.setInt("high",9 )))\
) */
export declare const evalLuaFlt: (luaCode: string, transport: number, defaultVal?: number, minimizeLifetime?: boolean) => number;
export declare const evalLuaInt: (luaCode: string, transport: number, defaultVal?: number, minimizeLifetime?: boolean) => number;
export declare const evalLuaStr: (luaCode: string, transport: number, defaultVal?: string, minimizeLifetime?: boolean) => string;
export declare const evalLuaObj: (luaCode: string, transport: number, defaultVal?: number, minimizeLifetime?: boolean) => number;
export declare const evalLuaForm: (luaCode: string, transport: number, defaultVal?: Form | null | undefined, minimizeLifetime?: boolean) => Form | null | undefined;
/** Inserts new (or replaces existing) {key -> value} pair. Expects that @transport is JMap object, if @transport is 0 it creates new JMap object.
Returns @transport */
export declare const setStr: (key: string, value: string, transport?: number) => number;
export declare const setFlt: (key: string, value: number, transport?: number) => number;
export declare const setInt: (key: string, value: number, transport?: number) => number;
export declare const setForm: (key: string, value: Form | null | undefined, transport?: number) => number;
export declare const setObj: (key: string, value: number, transport?: number) => number;