Log In  


Cart #function_tool-2 | 2024-03-17 | Embed ▽ | License: CC4-BY-NC-SA
26


I made a useful tool to look at what parameters are expected from picotron's api
You can also see in what file it is implemented and inspect the code!

It only works for functions that are implemented in lua, when it's done in c it's not visible, and some lua functions don't have much code in them and redirect a variable amount of parameters toward a c function

I also exported the list of functions with their parameters if I could find them:

table	USERDATA
C	USERDATA:__add
C	USERDATA:__band
C	USERDATA:__bor
C	USERDATA:__bxor
C	USERDATA:__div
C	USERDATA:__index
C	USERDATA:__len
C	USERDATA:__mod
C	USERDATA:__mul
C	USERDATA:__newindex
C	USERDATA:__sub
C	USERDATA:__tostring
C	USERDATA:add
C	USERDATA:attribs
C	USERDATA:band
C	USERDATA:bor
C	USERDATA:bxor
C	USERDATA:clear
C	USERDATA:convert
C	USERDATA:copy
C	USERDATA:cross
C	USERDATA:distance
C	USERDATA:div
C	USERDATA:dot
C	USERDATA:get
C	USERDATA:height
C	USERDATA:magnitude
C	USERDATA:matmul
C	USERDATA:matmul2d
C	USERDATA:matmul3d
C	USERDATA:mod
C	USERDATA:mul
C	USERDATA:set
C	USERDATA:sort
C	USERDATA:sub
C	USERDATA:transpose
C	USERDATA:width
table	_G
string	_VERSION
C	_fetch_local
C	_fetch_remote
Lua	_process_event_messages ()
C	_signal
C	_store_local
C	_update_buttons
Lua	abs (a)
C	add
Lua	add_line (s)
Lua	all (c)
C	apply_diff
C	assert
C	atan2
C	blit
C	btn
C	btnp
C	camera
C	cd
C	chr
C	circ
C	circfill
Lua	clear_key (scancode)
C	clip
C	cls
C	cocreate
C	collectgarbage
C	color
Lua	coresume (c, ...)
table	coroutine
C	coroutine:close
C	coroutine:create
C	coroutine:isyieldable
C	coroutine:resume
C	coroutine:running
C	coroutine:status
C	coroutine:wrap
C	coroutine:yield
C	cos
C	costatus
C	count
Lua	cp (f0, f1)
C	create_diff
Lua	create_gui (head_el)
Lua	create_process (prog_name, env_patch, do_debug)
Lua	create_undo_stack (, ...)
C	cursor
Lua	date (format)
table	debug
C	debug:debug
C	debug:gethook
C	debug:getinfo
C	debug:getlocal
C	debug:getmetatable
C	debug:getregistry
C	debug:getupvalue
C	debug:getuservalue
C	debug:setcstacklimit
C	debug:sethook
C	debug:setlocal
C	debug:setmetatable
C	debug:setupvalue
C	debug:setuservalue
C	debug:traceback
C	debug:upvalueid
C	debug:upvaluejoin
C	del
C	deli
C	dtime
Lua	env ()
C	error
Lua	exit (exit_code)
Lua	fetch (location, ...)
Lua	fetch_metadata (filename)
C	fget
C	fillp
C	flip
C	flr
Lua	foreach (c, _f)
C	fset
C	fstat
C	fullpath
Lua	function_info (fun)
C	get
Lua	get_clipboard ()
Lua	get_display ()
Lua	get_draw_target ()
Lua	get_spr (index)
C	getmetatable
Lua	include (filename)
C	ipairs
Lua	key (scancode)
Lua	keyp (scancode)
C	line
C	load
C	ls
Lua	map (ud, b, ...)
table	math
C	math:abs
C	math:acos
C	math:asin
C	math:atan
C	math:ceil
C	math:cos
C	math:deg
C	math:exp
C	math:floor
C	math:fmod
number	math:huge
C	math:log
C	math:max
number	math:maxinteger
C	math:min
number	math:mininteger
C	math:modf
number	math:pi
C	math:rad
C	math:random
C	math:randomseed
C	math:sin
C	math:sqrt
C	math:tan
C	math:tointeger
C	math:type
C	math:ult
Lua	max (a, b)
C	memcpy
Lua	memmap (addr, a, offset, len)
C	memset
Lua	menuitem (m, a, b)
Lua	mid (a, b, c)
Lua	min (a, b)
Lua	mkdir (p)
C	mount
Lua	mouse ()
C	music
Lua	mv (src, dest)
C	next
C	note
Lua	notify (msg_str)
Lua	on_event (event, f)
C	ord
C	oval
C	ovalfill
C	pack
C	pairs
C	pal
C	palt
C	pcall
C	peek
C	peek2
C	peek4
C	peek8
Lua	peektext (i)
C	pget
C	pid
Lua	pod (obj, flags, meta)
C	poke
C	poke2
C	poke4
C	poke8
Lua	print (str, x, y, col)
Lua	printh (str)
C	pset
C	pwd
Lua	pwf ()
C	rawequal
C	rawget
C	rawlen
C	rawset
Lua	readtext (clear_remaining)
C	rect
C	rectfill
Lua	reset ()
Lua	rm (f0)
C	rnd
C	select
C	send_message
C	set
Lua	set_clipboard (, ...)
Lua	set_draw_target (d)
Lua	set_spr (index, s, flags_val)
C	setmetatable
C	sfx
Lua	sgn (a)
C	sin
C	split
C	spr
C	sqrt
C	srand
C	sspr
C	stat
Lua	stop (txt, ...)
Lua	store (location, obj, meta)
Lua	store_metadata (filename, meta)
table	string
Lua	string:basename (self)
C	string:byte
C	string:char
C	string:dump
Lua	string:ext (self)
C	string:find
C	string:format
C	string:gmatch
C	string:gsub
Lua	string:hloc (self)
C	string:len
C	string:lower
C	string:match
C	string:pack
C	string:packsize
Lua	string:path (self)
C	string:rep
C	string:reverse
C	string:sub
C	string:unpack
C	string:upper
Lua	sub (str, ...)
C	t
table	table
C	table:concat
C	table:insert
C	table:move
C	table:pack
C	table:remove
C	table:unpack
Lua	theme (which)
C	time
C	tline3d
C	tokenoid
Lua	tonum (, ...)
C	tonumber
Lua	tostr (val, as_hex)
C	tostring
C	type
Lua	unmap (a)
C	unpack
C	unpod
C	userdata
table	utf8
C	utf8:char
string	utf8:charpattern
C	utf8:codepoint
C	utf8:codes
C	utf8:len
C	utf8:offset
C	vec
Lua	vid (mode)
C	warn
Lua	window (w, h, attribs)
Lua	wrangle_working_file (save_state, load_state, untitled_filename, get_hlocation, set_hlocation)
C	yield

26


now that I think about it, using hooks like I do here might be useful for a code editor, to show the origin of a function and it's parameter in a tooltip or something
I'm not sure if it's practical though, and would probably need to use sandboxing to avoid crashing all the time


Very cool! I like how you show the code for the Picotron functions. Makes it so much easier to find out what they do!


awesome, i was looking for something that would show me the function signatures of everything and not just their names, and showing the source too is even cooler! this is definitely gonna be used a lot :)


That's great, thank you!


Hey, I had no idea someone else was doing this, but was working on a variant of my own and seem to have caught a few yours missed. I'm going to run your code locally and see what you did that differed from my approach and hopefully we can combine that result into perfection.

Will update if I discover the answer.


@iiviiGames what missing functions did you find?

and see also https://www.lexaloffle.com/bbs/?tid=140816



[Please log in to post a comment]