Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

Commit dcfb37d

Browse files
Error when accessing a nonexistant GL constant.
1 parent d969f1a commit dcfb37d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

glfw_base.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ local jit = require "jit"
55

66
local Lib = {}
77

8+
setmetatable(glc, {__index=function(self, k) error("Unknown GL constant: "..k) end})
9+
810
-- Load and export libraries
911
local gl, glu, glfw
1012
if ffi.os == "Windows" then

test.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ local bit = require "bit"
66
-- Localize the FFI libraries
77
local gl, glc, glu, glfw, glext = lj_glfw.libraries()
88

9+
assert(pcall(function() local _ = glc.this_doesnt_exist end) == false)
10+
911
-- Define vertex arrays for the model we will draw
1012
local CubeVerticies = {}
1113
CubeVerticies.v = ffi.new("const float[8][3]", {

0 commit comments

Comments
 (0)