Skip to content

Latest commit

 

History

History
120 lines (95 loc) · 2.3 KB

Vanilla.md

File metadata and controls

120 lines (95 loc) · 2.3 KB

Lua functions

getidentity() -> returns 1

Get the current script identity

// ModScript is default
// recommend GameScript for advanced scripters (Found in corescripts)

enum ScriptContextLevel {
	SCL_ModScript, // Access to highest level of all documentation
	SCL_GameScript, // Rewritten/converted gamescripts (For example UI scripts) low level access to all classes
	SCL_Corescript, // Access to lua environment functions (Unstable so try not modify these as much as possible as these are more of the backend of the lua states
	SCL_Experimental // inherits all context levels aswell as the ability to change what level an environment has access to
};

C++ Utils

hookfunction(detour, original) -> returns 1
local __o__Print -- original print function

__o__Print = hookfunction(function(txt)
    local __o__Print("Modified '" .. txt .. "'")
end, Print)

Allows you to detour functions aswell as get the original like a minhook library would


wait(seconds) -> returns 0
Print("Hello")
wait(1) -- wait one second then print world
Print("World")

Wait X amount of seconds

Other utils

KeyHeld(keyid) -> returns 1
local w = KeyHeld(87) ; a = KeyHeld(65)
	; s = KeyHeld(83) ; d = KeyHeld(68)

if not w and not a and not s and not d then
    -- code for not moving
end

Returns the current stored keymap state of keyid key


Print(str) -> returns 0
Print("Hello " .. " World!")

Log string both to debug stream and log file or ease of debugging


getfenv() -> returns 1

Get the environment of a function


getgenv() -> returns 1

Get the environment that will be applied to each script ran by light api


getreg() -> returns 1

Get the lua registry


keypress(keyid) -> returns 0
keypress(87)
wait(1)
keyrelease(87) -- hold w for 1 second

Simulate a keypress - https://www.oreilly.com/library/view/javascript-dhtml/9780596514082/apb.html


keyrelease(keyid) -> returns 0

Simulate a keyrelease - https://www.oreilly.com/library/view/javascript-dhtml/9780596514082/apb.html


GetHttp(str) -> returns 1
local txt = GetHttp("https://pastebin.com/raw/skJgB2mU")
Print(txt) -- > Prints Example Text

Get URL data