Repository navigation
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
MeekLuaTableParser.js converts a LUA file into a JSON object. This js object does not include any file loading, but only simple string handling. We neither determine table types, objects, etc., nor validate values. We assume the LUA table file was generated by another application, and adheres to a strict format. Thus we simplified our regular expression parsers, and removed error checking. Additionally, we assume end of lines are '\n'. We have included MeekArtisan.html as an example, on how to use the js within an HTML page. We do not include a test/demo LUA table file. The HTML page requires an internet connection, as it uses jQuery and jQuery-ui from the Google repository. Web browsers prevent loading files (cross origin errors,) because of security, thus we use jQuery/jQuery-ui to open and upload a file. The HTML example file does not display the JSON object, it only loads and parses the file into a JSON object. Please use your browser console, or other forms of debugging/testing for development. We use the javascript function console.log() to help debug and test, please comment these out if they are causing errors. ————— Example Usage: var mltp = new MeekLuaTableParser(); //var test = mltp.toJSONString(text);console.log(test); var json = mltp.toJSON(text); console.log(json[“YourTable_Name”]); We instantiate the object. We use the object’s toJSONString function for testing. The variable “text” is a string of the imported LUA file. The “text” string is an entire read of the LUA file, nothing special, nothing parsed; a string. We call the object’s toJSON to convert the LUA file string into a JSON object.