#Should prob have created a thread lol
1 messages · Page 1 of 1 (latest)
couldn't you do just split the code by spaces and check if the word is defined method in ur API?
highlight.js remove all html elements by the looks of it
simplistic view may have some weird bugs, but probably could achieve it with regex
Besides, the client doesn't know what function is valid. And highlight.js is clientside
I would need a Lua env or parser to get the results.
yeah but you could make a javascript array with valid functions
idk what u mean by that
i doubt that gmod wiki is running some lua env to do highlighting like this
it's probably some array of keywords that automatically get highlighted
An object returned by util. Stack.
Like a Lua table, a Stack is a container. It follows the principle of LIFO (last in, first out).
The Stack works like a stack of papers: the first page you put down (push) will be the last one you remove (pop). That also means that the last page you put down, will be the first to be removed.
:Push is highlighted
To get the method type, it would need to know what the variable is. To know that, it would need to know what the function returns.
ah okay, I see I didnt know it did that
now I understand 👍
idk if thats a lua env doing that, but probably not worth
Besides my browser reports there are above 4k native functions. Don't think the clients like making that many string compares. And we havent even started on metatables.
Sadly ye
why not just split text by spaces (this should also support tbl.func, obj:func) & index every word in assoc array like:
for i, v in ipairs( player.GetAll() ) do
ipairs > Global.ipairs
player > player
GetAll > player.GetAll
(%s?[%S]+) by spaces
%S+%.(%S+)%(? by a.b
%S+:(%S+)%(? by a:b
I think there is a way to do it with just text manipulation, but probably so weird/a lot of edge cases
btw at this moment it doesnt highlight lib functions (facepunch wiki does)
but i dont think it matters
Unless native Lua 5.3 has NikNaks build it, it won't highlight those functions as it doesn't know about them.
As I stated before, I use highlight.js to highlight the code.
To get the same functions as Gmod wiki. I would need to create a Lua emulator or env for the server to compile the code.
Then generate the html code from it
there are some lua parsers made with js already, might be worth looking at if you're interested enough lol