#Should prob have created a thread lol

1 messages · Page 1 of 1 (latest)

hollow roost
#

couldn't you do just split the code by spaces and check if the word is defined method in ur API?

twilit zenith
#

highlight.js remove all html elements by the looks of it

hollow roost
#

simplistic view may have some weird bugs, but probably could achieve it with regex

twilit zenith
#

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.

hollow roost
#

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

twilit zenith
#
#

: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.

hollow roost
#

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

twilit zenith
#

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.

hollow roost
#

probably is a lua env lol

twilit zenith
#

Sadly ye

native lake
#

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

hollow roost
#

I think there is a way to do it with just text manipulation, but probably so weird/a lot of edge cases

native lake
#

btw at this moment it doesnt highlight lib functions (facepunch wiki does)

#

but i dont think it matters

twilit zenith
#

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

real reef
#

there are some lua parsers made with js already, might be worth looking at if you're interested enough lol