UNPKG

@skyrim-platform/jcontainers

Version:

TypeScript library for the JContainers Skyrim modding utility

86 lines (78 loc) 4.23 kB
/* ============================================== Typescript definitions for v4.2.1 ============================================== This file was automatically generated by Papyrus-2-Typescript.exe https://github.com/CarlosLeyvaAyala/Papyrus-2-Typescript The program has no way to know the intention of the humans that made the scripts, so it's always advisable to manually check all generated files to make sure everything is declared as it should. Take note the program assumes this script exists in some subfolder to the folder where `skyrimPlatform.ts` is found, otherwise you'll get "Cannot find module..." type of errors. If you want to have this script in some other place, just change the relative path of each `import`. */ import * as sp from "skyrimPlatform"; /** Evaluates Lua code. Unstable API - I'm free to change or remove it anytime */ var sn = sp.JLua; /** 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 var evalLuaFlt = function (luaCode, transport, defaultVal, minimizeLifetime) { if (defaultVal === void 0) { defaultVal = 0.0; } if (minimizeLifetime === void 0) { minimizeLifetime = true; } return sn.evalLuaFlt(luaCode, transport, defaultVal, minimizeLifetime); }; export var evalLuaInt = function (luaCode, transport, defaultVal, minimizeLifetime) { if (defaultVal === void 0) { defaultVal = 0; } if (minimizeLifetime === void 0) { minimizeLifetime = true; } return sn.evalLuaInt(luaCode, transport, defaultVal, minimizeLifetime); }; export var evalLuaStr = function (luaCode, transport, defaultVal, minimizeLifetime) { if (defaultVal === void 0) { defaultVal = ""; } if (minimizeLifetime === void 0) { minimizeLifetime = true; } return sn.evalLuaStr(luaCode, transport, defaultVal, minimizeLifetime); }; export var evalLuaObj = function (luaCode, transport, defaultVal, minimizeLifetime) { if (defaultVal === void 0) { defaultVal = 0; } if (minimizeLifetime === void 0) { minimizeLifetime = true; } return sn.evalLuaObj(luaCode, transport, defaultVal, minimizeLifetime); }; export var evalLuaForm = function (luaCode, transport, defaultVal, minimizeLifetime) { if (defaultVal === void 0) { defaultVal = null; } if (minimizeLifetime === void 0) { minimizeLifetime = true; } return sn.evalLuaForm(luaCode, transport, defaultVal, minimizeLifetime); }; /** 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 var setStr = function (key, value, transport) { if (transport === void 0) { transport = 0; } return sn.setStr(key, value, transport); }; export var setFlt = function (key, value, transport) { if (transport === void 0) { transport = 0; } return sn.setFlt(key, value, transport); }; export var setInt = function (key, value, transport) { if (transport === void 0) { transport = 0; } return sn.setInt(key, value, transport); }; export var setForm = function (key, value, transport) { if (transport === void 0) { transport = 0; } return sn.setForm(key, value, transport); }; export var setObj = function (key, value, transport) { if (transport === void 0) { transport = 0; } return sn.setObj(key, value, transport); };